<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .parent{
            width:400px;
            height:400px;
            border:1px solid red;
            margin:100px auto;

            /*透视*/
            perspective: 500px;
            /*开启子元素的3d渲染*/
            transform-style: preserve-3d;

            transform:rotateY(30deg);

            transition:transform 2s;
        }
        .child{
            width:200px;
            height:200px;
            margin:100px auto;
            background-color: darkblue;
            /*沿x轴旋转*/
           /* transform:rotateX(30deg);*/
            /*沿y轴旋转*/
            /* transform:rotateY(45deg);
            */
            /*沿z轴旋转*/
           /* transform:rotateZ(30deg);*/



        }
        .parent:hover .child{
           /* transform:rotateZ(30deg);*/
            /*沿自定义轴旋转*/
            transform:rotate3d(1,1,0,30deg);
        }
    </style>
</head>
<body>
<div class="parent">
    <div class="child"></div>
</div>

</body>
</html>